using System;
using System.Reflection;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.DXperience.Demos;
using LPV.Gauges;

namespace LPV.Gauges
{
    public class DemosInfo : ModulesInfo
    {
        public static void ShowModule(DevExpress.XtraEditors.GroupControl group)
        {
            if (Instance.CurrentModuleBase == null)
                DemosInfo.Add("Analog Clock", typeof(LPV.Gauges.AnalogClock));

            ModuleInfo oModuleInfo = DemosInfo.GetItem("Analog Clock");
            
			Cursor currentCursor = Cursor.Current;
			Cursor.Current = Cursors.WaitCursor;
            try
            {
                System.Windows.Forms.Control oldTutorial = null;
                if (Instance.CurrentModuleBase != null)
                {
                    //if (Instance.CurrentModuleBase.Name == "Analog Clock") 
                    //    return;
                    oldTutorial = Instance.CurrentModuleBase.TModule;
                }

//                TutorialControlBase tutorial = oModuleInfo.TModule as TutorialControlBase;
                AnalogClock tutorial = new AnalogClock();
                tutorial.Bounds = group.DisplayRectangle;
                Instance.CurrentModuleBase = oModuleInfo;
                tutorial.Visible = false;
                group.Controls.Add(tutorial);
                tutorial.Dock = DockStyle.Fill;

                tutorial.Visible = true;
                oModuleInfo.WasShown = true;
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
			finally 
            {
				Cursor.Current = currentCursor;
			}
			RaiseModuleChanged();
		}
	}
}
